best way to write a-> ..->[a] recursive functions in haskell

Posted by Roman A. Taycher on Stack Overflow See other posts from Stack Overflow or by Roman A. Taycher
Published on 2010-06-09T05:25:14Z Indexed on 2010/06/09 5:32 UTC
Read the original article Hit count: 161

Filed under:
|

So I keep having this small problem where I have something like

func :: a -> b -> [a]  -- or basically any a-> ...-> [a] where ... is any types  ->
func x y = func' [x] y -- as long as they are used to generate a list of [a] from x

func' :: [a] -> b -> [a] 
func = undefined --situation dependant generates a list from each element and returns it as one long list

should I keep it like this?

should I use func' hidden by a where?

should I only use the [a] -> b -> [a] version and leave the responsibility of passing [variable] to the callee?

I might well need to compose these functions and might want to mess around with the order so I'm leaning towards option 3. What do you think?

© Stack Overflow or respective owner

Related posts about haskell

Related posts about recursion